/**
 * Created by Administrator on 2016/11/12 0012.
 */

//change background picture when cursor move in and move out

var $1 = $('.user_1');
var $2 = $('.user_2');
var $3 = $('.user_3');
var $4 = $('.user_4');

$1.mouseover(function () {
  $('.use_img_1').attr('src', '/static/home/use2.png')
});
$2.mouseover(function () {
  $('.use_img_2').attr('src', '/static/home/use4.png')
});
$3.mouseover(function () {
  $('.use_img_3').attr('src', '/static/home/use6.png')
});
$4.mouseover(function () {
  $('.use_img_4').attr('src', '/static/home/use8.png')
});
$1.mouseout(function () {
  $('.use_img_1').attr('src', '/static/home/use1.png')
});
$2.mouseout(function () {
  $('.use_img_2').attr('src', '/static/home/use3.png')
});
$3.mouseout(function () {
  $('.use_img_3').attr('src', '/static/home/use5.png')
});
$4.mouseout(function () {
  $('.use_img_4').attr('src', '/static/home/use7.png')
});


//    录播图自动轮播
var swiper = new Swiper('.swiper-container', {
  autoplay: 3000,
  autoplayDisableOnInteraction: false,
  pagination: '.swiper-pagination',
  nextButton: '.swiper-button-next',
  prevButton: '.swiper-button-prev',
  slidesPerView: 1,
  paginationClickable: true,
  spaceBetween: 30,
  loop: true
});


// homepage gallery
$(".main_title li").click(function () {
  $(".main_title li").removeClass("active");
  $(this).addClass("active ");
  var index = $(this).index();
  console.log(index);
  $('.main_text li').css('display', 'none');
  $('.main_text li:eq(' + index + ')').css('display', 'block');
  if (index == 0) {
    $('.main_img li:eq(0) img').attr('src', '/static/img/home/shopping_2.png');
    $('.main_img li:eq(1) img').attr('src', '/static/img/home/game_1.png');
    $('.main_img li:eq(2) img').attr('src', '/static/img/home/center_2.png');
  }
  else if (index == 1) {
    $('.main_img li:eq(0) img').attr('src', '/static/img/home/game_2.png');
    $('.main_img li:eq(1) img').attr('src', '/static/img/home/center_1.png');
    $('.main_img li:eq(2) img').attr('src', '/static/img/home/shopping_2.png');
  } else if (index == 2) {

    $('.main_img li:eq(0) img').attr('src', '/static/img/home/center_2.png');
    $('.main_img li:eq(1) img').attr('src', '/static/img/home/shopping_1.png');
    $('.main_img li:eq(2) img').attr('src', '/static/img/home/game_2.png');
  }
});



